﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using GomMinhLongDO;
using GomMinhLongBL;

namespace GomMinhLong.AdminCP.PageUC
{
    public partial class ucCartNonUser : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                gvDonHangNonUserDataSource();
        }

        protected void lbtnXuLy_Click(object sender, CommandEventArgs e)
        {
            int id = int.Parse(e.CommandArgument.ToString());

            cmsDonHangDO obj = new cmsDonHangBL().Select(new cmsDonHangDO { DonHangID = id});
            bool XuLy = !bool.Parse(obj.XuLy.ToString());
            new cmsDonHangBL().Update(obj);

            gvDonHangNonUserDataSource();
        }
        protected void imgbtnDelete_Click(object sender, CommandEventArgs e)
        {
            int id = int.Parse(e.CommandArgument.ToString());
            new cmsDonHangBL().Delete(new cmsDonHangDO { DonHangID = id });
            Functions.Alert("Xóa bản ghi thành công!", Request.Url.ToString());
        }

        protected void gvDonHangNonUserDataSource()
        {
            gvDonHangNonUser.DataSource = new cmsDonHangBL().SelectUser(0);
            gvDonHangNonUser.DataBind();
        }

        protected void gvDonHangNonUser_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gvDonHangNonUser.PageIndex = e.NewPageIndex;
            gvDonHangNonUserDataSource();
        }

        
    }
}